﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>选取型号</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="/Static/jquery-1.6.2.min.js" type="text/javascript"></script>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <script src="/Static/boot.js" type="text/javascript"></script>
    <link href="/Static/demo.css" rel="stylesheet" />
    <link href="/Static/miniui/themes/blue/skin.css" rel="stylesheet" />

    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
            border: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <div class="mini-toolbar" style="padding-bottom: 2px; padding-left: 1px; margin: 2px">

        <span>型号名称：</span>
        <input type="text" id="txt_KeyValue" class="mini-textbox" style="width: 100px" />
        <a class="mini-button" onclick="searchUser()" iconcls="icon-search" plain="true">查询</a>
        <span class="separator"></span>
        <a class="mini-button" onclick="clearWhere()" iconcls="icon-remove" plain="true">清空条件</a>
        <span class="separator"></span>
        <a class="mini-button" iconcls="icon-reload" onclick="reloadData()" plain="true">刷新</a>
    </div>
    <div class="mini-fit" style="padding: 0px 0px 0px 0px;">

        <div id="dv_UserList" class="mini-datagrid" style="width: 100%; height: 100%;" url="/Ajax/AjaxService.aspx?method=GetPartsModelList&sortField=m.IsAvailable&sordOrder=DESC&isActive=Y"
             idfield="ID" allowresize="true" sizelist="[10,15,20,50,100,200,300,500]"
             pagesize="10" onrowdblclick="onOk">
            <div property="columns">
                <div type="checkcolumn" width="10">
                </div>
                <div type="indexcolumn" width="20" allowsort="true">
                    序号
                </div>
                <div field="BrandsDisplayName" width="50" headeralign="center" align="center" allowsort="true">
                    所属品牌显示名称
                </div>
                <div field="ModelName" width="50" headeralign="center" align="center" allowsort="true">
                    型号名称
                </div>
                <div field="ModelDisplayName" width="100" headeralign="center" align="center" allowsort="true">
                    型号显示名称
                </div>
            </div>
        </div>
    </div>
    <div class="mini-toolbar" style="text-align: center; padding-top: 8px; padding-bottom: 8px;"
         borderstyle="border-left:0;border-bottom:0;border-right:0;">
        <a class="mini-button" style="width: 60px;" onclick="onOk()">确定</a> <span style="display: inline-block;
            width: 25px;"></span><a class="mini-button" style="width: 60px;" onclick="onCancel()">
            关闭
        </a>
    </div>

    <script type="text/javascript">
        mini.parse();
        var grid = mini.get("dv_UserList");
        //grid.load();
        //默认对"UserID"字段，进行降级排序
        grid.sortBy("ID", "Asc");
        /**查询******************************************************************************/
        function searchUser() {
            var keyValue = mini.get("txt_KeyValue").getValue();
            grid.load({ keyValue: keyValue });
        }


        //-----------------------------清空条件-------------------------
        function clearWhere() {
            mini.get("txt_KeyValue").setValue("");
        }

        function reloadData() {
            grid.sortBy("ID", "desc");
            clearWhere();
            grid.load();
        }

        /**接收父页面参数******************************************************/
        function SetPara(data) {
            //data.MultiSelect是true或者false;
            //设置gridView的多选属性
            //  alert(data.MultiSelect);
            grid.set({ multiSelect: data.MultiSelect });
            searchUser();

        }
        /**接收父页面参数******************************************************/
        function SetData(data) {
            //data.MultiSelect是true或者false;
            //设置gridView的多选属性
            // alert(data.MultiSelect);
            grid.set({ multiSelect: data.MultiSelect });
            searchUser();

        }


        /**在页面按下回车是激发搜索事件******************************************************/

        $("#txt_KeyValue").bind("keydown", function (e) {
            if (e.keyCode == 13) {
                searchUser();
            }
        });
        //转换字符
        //自定义绘图绑定状态、岗位级别
        var Active = $.ajax({
            url: "/ConfigData/isActived.txt",
            cache: false,
            async: true,
            success: function (text) {
                Active = jQuery.parseJSON(text);

            }
        });
        function onActive(e) {
            for (var i = 0, l = Active.length; i < l; i++) {
                var g = Active[i];
                if (g.id == e.value) return g.text;
            }
            return "";
        }
        /**获取页面返回值*********************************************************************/
        function GetData() {
            var rows = grid.getSelecteds();

            return rows;

        }
        /**关闭窗口*********************************************************************/
        function CloseWindow(action) {
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();
        }
        function onOk() {
            if (grid.getSelecteds().length == 0) {
                alert("未选中任何行");
                return;
            }
            CloseWindow("ok");
        }
        function onCancel() {
            //清空
            CloseWindow("clear");
        }

    </script>

</body>
</html>
